﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PhotoMgr.src.common;
using System.Windows.Forms;
using PhotoMgr.src.database;

namespace PhotoMgr.src.gui.category
{
    class SettingList : ListBase
    {
        public SettingList(string title, FormAction action)
            : base(title, action)
        {
            DataColumns = new DataGridViewColumn[] 
            { 
                Global.GenColumn("Số hiệu"                      , "SettingID"),
                Global.GenColumn("Tên thiết lập"                , "SettingName").SetSizeMode(DataGridViewAutoSizeColumnMode.Fill),
                Global.GenColumn("Thông số tối đa"              , "MaxScore"),
                Global.GenColumn("Cho phép có số"               , "AllowDecimalScore", Global.GenColumnType.CheckBox ),
                Global.GenColumn("Thời gian hoãn"               , "DelayTime"),
                Global.GenColumn("Tình trạng"                   , "StatusName"),
            };

            SearchControls = new SearchBox[]{                
                new SearchBox().initTextBox("Số hiệu=SettingID"),
                new SearchBox().initTextBox("Tên thiết lập=SettingName"),
                new SearchBox().initComboBox("Tình trạng=Status", new SearchBox.InitStatusComboBoxDelegate(Global.InitStatusCombobox), Global.StatusType.Status, true ),
            };

            OwnerSearchBoxIndex = -1;
            SelectedColumnName = "SettingID";
            SearchFunction = DBManager.Search_Setting;
            DetailFormType = typeof(PhotoMgr.src.gui.category.SettingDetaill);
        }
    }
}
